package com.hugh.demo.controller;

import com.hugh.demo.service.IDemoService;
import com.hugh.edu.mvcframework.annotations.HughAutowired;
import com.hugh.edu.mvcframework.annotations.HughController;
import com.hugh.edu.mvcframework.annotations.HughRequestMapping;
import com.hugh.edu.mvcframework.annotations.HughSecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@HughController
@HughRequestMapping("/demo2")
public class Demo2Controller {


    @HughAutowired
    private IDemoService demoService;

    /**
     * URL: /demo/query?username=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @HughRequestMapping("/query1")
    @HughSecurity({"zhangsan"})
    public String query1(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);
    }

    /**
     * URL: /demo/query?username=lisi
     * @param request
     * @param response
     * @param username
     * @return
     */
    @HughRequestMapping("/query2")
    public String query2(HttpServletRequest request, HttpServletResponse response,String username) {
        return demoService.get(username);
    }
}
